@extends('layout.admin')

@section('content')
<!-- 放置一个html表单 -->

<script type="text/javascript" charset="utf-8" src="/admins/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/admins/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/admins/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" charset="utf-8" src="/admins/js/libs/jquery-1.8.3.min.js"></script>

<div class="mws-panel grid_8">
    <div class="mws-panel-header">
        <span>商品修改</span>
    </div>
    <div class="mws-panel-body no-padding">
        <form class="mws-form" action="/goods/doedit" method="post" enctype="multipart/form-data">
        @if (count($errors) > 0)
            <div class="mws-form-message warning">
                @foreach ($errors->all() as $error)
                {{$error}}<br>
                @endforeach
            </div>
        @endif
            <div class="mws-form-inline">
                <div class="mws-form-row">
                    <label class="mws-form-label">商品名</label>
                    <div class="mws-form-item">
                        <input class="small" type="text" name="gname" value="{{$goods->gname}}">
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">商品图片</label>
                    <div class="mws-form-item">
                        @foreach($pics as $k=>$v)
                        <img src="{{$v->path}}" width='50px'>
                        @endforeach
                        <input class="small"  type="file" name="path[]" multiple>
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">价格</label>
                    <div class="mws-form-item">
                        <input class="small" type="text" name="price" value = "{{$goods->price}}">
                    </div>
                </div>

                <div class="mws-form-row">
                    <label class="mws-form-label">库存</label>
                    <div class="mws-form-item">
                        <input class="small" type="text" name="cnt" value = "{{$goods->cnt}}">
                    </div>
                </div>

                <div class="mws-form-row">
                    <label class="mws-form-label">颜色</label>
                    <div class="mws-form-item">
                        <ul id='color' class="mws-form-list inline">
                            <li><input type="checkbox" name="color[]" value="红色"> <label>红色</label></li>
                            <li><input type="checkbox" name="color[]" value="黑色"> <label>黑色</label></li>
                            <li><input type="checkbox" name="color[]" value="白色"> <label>白色</label></li>
                            <li><input type="checkbox" name="color[]" value="青色"> <label>青色</label></li>
                            <li><input type="checkbox" name="color[]" value="黄色"> <label>黄色</label></li>
                        </ul>
                    </div>
                </div>

                <div class="mws-form-row">
                    <label class="mws-form-label">尺码</label>
                    <div class="mws-form-item">
                        <ul id='size' class="mws-form-list inline">
                            <li><input type="checkbox" name="size[]" value="xl"> <label>xl</label></li>
                            <li><input type="checkbox" name="size[]" value="xxl"> <label>xxl</label></li>
                            <li><input type="checkbox" name="size[]" value="l"> <label>l</label></li>
                            <li><input type="checkbox" name="size[]" value="m"> <label>m</label></li>
                            <li><input type="checkbox" name="size[]" value="s"> <label>s</label></li>
                        </ul>
                    </div>
                </div>  
<!--                <div class="mws-form-row">
                    <label class="mws-form-label">商品图片</label>
                    <div class="mws-form-item">
                        <input class="small" type="file" name="">
                    </div>
                </div> -->
                <div class="mws-form-row">
                    <label class="mws-form-label">商品描述</label>
                    <div class="mws-form-item">
                        <script id="editor" name = "detail" type="text/plain" style="width:750px;height:500px;">{{$goods->detail}}</script>
                    </div>
                </div>
            </div>
            <div class="mws-button-row">
                {{csrf_field()}}
                <input type="hidden" name="gid" value="{{$goods->gid}}">
                <input value="修改" class="btn btn-danger" type="submit">
                <input value="重置" class="btn " type="reset">
            </div>
        </form>
    </div>      
</div>
<script type="text/javascript" charset="utf-8" src="/admins/goods/goodsEdit.js"></script>
<script type="text/javascript">
    var ue = UE.getEditor('editor');
    initSelect('{!! $size !!}','{!! $color !!}');

</script>


@endsection